package concurrencyPractice.chapter06;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @author xinya
 * @version 1.0
 * @project javacore
 * @description 程序6-4 基于线程池的web服务器
 * @date 2024/1/3 09:59:52
 */
public class TaskExecutionWebServer {
    private static final int NTHREADS = 100;
    private static final Executor exec = Executors.newFixedThreadPool(NTHREADS);

    public static void main(String[] args) throws IOException {
        ServerSocket socket = new ServerSocket(80);
        while (true) {
            final Socket connection = socket.accept();
            Runnable task = new Runnable() {
                @Override
                public void run() {
//                    handleRequest(connection);
                }
            };
            exec.execute(task);
        }
    }
}
